<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商机</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <!-- Data Tables -->
    <link href="css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="css/plugins/dataTables/dataTables.responsive.css" rel="stylesheet">
    <link href="css/plugins/dataTables/dataTables.tableTools.min.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="css/css.css" />
</head>
<body style="background-color:white">
	 <div class="pageTop" style="position:relative;height:50px">
            <div class="page">
                <img src="img/coin02.png" /><span><a href="main.do">首页</a>&nbsp;-&nbsp;-</span>&nbsp;<a href="getBusinessList.do">商机管理</a>
            </div>
     </div>
    <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                           <button class="userbtn" onclick="window.location.href='tochancemanage_add.do'" 
	  						style="border-radius:15px;font-size: 10px;color: #fff;background-color: #47a4e1;width:80px;height:40px;">新增商机</button>	
                        </div>
                        <div class="ibox-content">
                            <table class="table table-striped table-bordered table-hover " id="editable">
                                    <thead>
                                    <tr >
                                        <th style="text-align:center">编号</th>
                                        <th style="text-align:center">机构名称</th>
                                        <th style="text-align:center">机构级别</th>
                                        <th style="text-align:center">阶段状态</th>
                                        <th style="text-align:center">跟进状态</th>
                                        <th style="text-align:center">经办人</th>
                                        <th style="text-align:center">联系人</th>
                                        <th style="text-align:center">审核状态</th>
                                        <th style="text-align:center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${sessionScope.busiList }" var="business">
                                    <tr class="gradeX">
                                        <td>${business.id }</td>
                                        <td>${business.org.name }</td>
										<td>
											<c:if test="${business.org.type ==1}">政府</c:if>
											<c:if test="${business.org.type ==2}">学校</c:if>
											<c:if test="${business.org.type ==3}">企业</c:if>
											<c:if test="${business.org.type ==4}">其他</c:if>
										</td>
										<td>
											<c:if test="${business.stage ==1}">初步接洽</c:if>
											<c:if test="${business.stage ==2}">需求确定</c:if>
											<c:if test="${business.stage ==3}">报价</c:if>
											<c:if test="${business.stage ==4}">合同</c:if>
											<c:if test="${business.stage ==5}">赢单</c:if>
										</td>
										<td>
											<c:if test="${business.follow  ==1}">意向</c:if>
											<c:if test="${business.follow  ==2}">潜在</c:if>
											<c:if test="${business.follow  ==3}">报价</c:if>
											<c:if test="${business.follow  ==4}">成交</c:if>
										</td>
										<td>${business.org.contact.ename}</td>
										<td>${business.org.contact.name }</td>
										<td>
											<c:if test="${business.checkstate ==0}">未审核</c:if>
											<c:if test="${business.checkstate ==1}">已审核</c:if>
										</td>
										<td>
											<a href="tobusinessinfoupdate.do?id=${business.id }"><img class="operation" src="img/update.png"></a> 
											<a href="tobusinessinfodetail.do?id=${business.id }"><img class="operation" src="img/view.png"></a>
											<a onclick="if(confirm('确定删除?')==false)return false" href="businessinfodel.do?id=${business.id }"><img class="operation delban" src="img/delete.png"></a>
										</td>	
                                    </tr>
                                   	</c:forEach>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
        

<!-- Mainly scripts -->
<script src="js/jquery-2.1.1.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>

<!-- Data Tables -->
<script src="js/plugins/dataTables/jquery.dataTables.js"></script>
<script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script src="js/plugins/dataTables/dataTables.responsive.js"></script>


<!-- Custom and plugin javascript -->
<script src="js/inspinia.js"></script>

<!-- Page-Level Scripts -->
<script>
    $(document).ready(function () {
        $('.dataTables-example').dataTable({
            responsive: true,
            "dom": 'T<"clear">lfrtip',
            "tableTools": {
                "sSwfPath": "js/plugins/dataTables/swf/copy_csv_xls_pdf.swf"
            }
        });

        /* Init DataTables */
        var oTable = $('#editable').dataTable();

        /* Apply the jEditable handlers to the table */
        oTable.$('td').editable('../example_ajax.php', {
            "callback": function (sValue, y) {
                var aPos = oTable.fnGetPosition(this);
                oTable.fnUpdate(sValue, aPos[0], aPos[1]);
            },
            "submitdata": function (value, settings) {
                return {
                    "row_id": this.parentNode.getAttribute('id'),
                    "column": oTable.fnGetPosition(this)[2]
                };
            },

            "width": "90%",
            "height": "100%"
        });

    });

    function fnClickAddRow() {
        $('#editable').dataTable().fnAddData([
            "Custom row",
            "New row",
            "New row",
            "New row",
            "New row"]);

    }
	
</script>

</body>
</html>